package my.suveng.oauth2.model.struct;

import my.suveng.oauth2.model.dto.UserAddDto;
import my.suveng.oauth2.service.db.mysql.model.entity.SysUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SysUserStructMapper {

    SysUserStructMapper INSTANCE = Mappers.getMapper(SysUserStructMapper.class);

    /**
     * dto -> entity
     * 
     * @author suwenguang
     */
    @Mappings({ @Mapping(target = "username", source = "dto.username"),
            @Mapping(target = "password", source = "dto.password"), })
    SysUser dto2entity(UserAddDto dto);

    List<SysUser> dtos2entitys(List<UserAddDto> dtos);

}
